package terra.model.visual;

import org.newdawn.slick.Graphics;
import org.newdawn.slick.Image;

import terra.Config;
import terra.managers.LightManager;
import terra.model.GameObject;
import terra.slick.GameState;

public class StaticImageVisualizator extends AbstractVisualizator
{
	
	@Override
	public void draw(Graphics g, GameObject object, float x, float y) {
		if (blend) {
			int x1 = GameState.getInstance().getTiledOffsetX()-4;
			int y1 = GameState.getInstance().getTiledOffsetY()-4;
			LightManager.getInstance().blend((int)(object.getX()/Config.tileSize-x1),(int)(object.getY()/Config.tileSize-y1),(Image) render);
			if (width == -1 ||  height == -1)
				((Image) render).draw(x, y);
			else
				((Image) render).draw(x, y,width,height);
		} else {
			LightManager.eraseBlend((Image) render);
			if (width == -1 ||  height == -1)
				((Image) render).draw(x, y);
			else
				((Image) render).draw(x, y,width,height);
		}
	}

	@Override
	public void update(int delta){
		//nothing to update
	}
	
	
}
